package neo.aoi;

import artofillusion.ObjectEditorWindow;
import artofillusion.Scene;
import artofillusion.math.BoundingBox;
import artofillusion.math.CoordinateSystem;
import artofillusion.math.Vec3;
import artofillusion.object.Cube;
import artofillusion.object.Object3D;
import artofillusion.object.ObjectInfo;

public class ScriptTestRubish {
	public static void function(ObjectEditorWindow window) {
		Scene scene = window.getScene();
		ObjectInfo avion= scene.getObject("avion");

		BoundingBox bounds = avion.object.getBounds();
		double deltaX = bounds.minx+(bounds.maxx-bounds.minx)/2;
		double deltaY = bounds.miny+(bounds.maxy-bounds.miny)/2;
		double deltaZ = bounds.minz+(bounds.maxz-bounds.minz)/2;

		ObjectInfo objinfo = new ObjectInfo(avion.object, new CoordinateSystem(
				new Vec3(-deltaX, -deltaY, -deltaZ), 0, 0, 0), "Objeto");

		double z = 0.0;
		double res = 1.0;
		Object3D ip = new Cube(1.1*(bounds.maxx-bounds.minx),
				1.1*(bounds.maxy-bounds.miny), res); // Intersection Plane
		ObjectInfo ip_info = new ObjectInfo(ip, new CoordinateSystem(
				new Vec3(0, 0, z), 0, 0, 0), "cubo");

		scene.addObject(objinfo, null);
		scene.addObject(ip_info, null);
	}
}
